package com.imooc.user.provider.model;

import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @Author Tim
 * @Description: 群类型
 * @Version 1.0
 */
@Getter
public enum GroupType {
    CLASS(1, "班级群"),
    GRADE(2, "年级群"),
    SCHOOL(3, "学校群"),
    EDUCATION(4, "教育局群"),
    ORDINARY(5, "教育局群"),
    ;
    private Integer type;
    private String groupName;

    GroupType(Integer type, String groupName){
        this.type = type;
        this.groupName = groupName;
    }
    private static final Map<Integer, GroupType> typeMap;
    static {
        typeMap = Arrays.stream(GroupType.values()).collect(Collectors.toMap(GroupType::getType, a -> a));
    }

    public static GroupType parse(Integer type) {
        if (typeMap.containsKey(type)) {
            return typeMap.get(type);
        }
        return null;
    }

}
